package com.fast.common.util;

import java.security.MessageDigest;

import org.apache.commons.codec.binary.Hex;

public class PasswordUtil {

	public static String getMd5Password(String password) {
		String pswd = null;
		pswd = md5Digest(password, "fxwk");
		return pswd;
	}

	public static String md5Digest(String srcMsg, String key) {
		try {
			if (key == null) {
				key = "";
			}
			MessageDigest digest = MessageDigest.getInstance("MD5");
			digest.update((srcMsg + key).getBytes("UTF-8"));
			return Hex.encodeHexString(digest.digest());
		} catch (Exception e) {
			throw new RuntimeException("md5Digest failure", e);
		}
	}
}